﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DOTNETGROUP.Entities;
using DOTNETGROUP.Data;

public partial class Controls_ControlMauWebBottom : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Pager1.CurrentIndex = 1;
            Bind_Data1(Pager1.CurrentIndex);
        }
    }
    //--------------------------
    protected void Bind_Data1(int PageNo)
    {
        int TotalRows = 0;
        string WhereClause = "1=1";
        TList<MauWeb> TList_MauWeb = DataRepository.MauWebProvider.GetPaged(WhereClause, "", PageNo - 1, Pager1.PageSize, out TotalRows);
        dlkhoahoc1.DataSource = TList_MauWeb;
        dlkhoahoc1.DataBind();
        Pager1.ItemCount = TotalRows;
        H_PageCount.Value = Pager1.PageCount.ToString();
    }
    protected void Pager1_Command(object sender, CommandEventArgs e)
    {
        try
        {
            int currnetPageIndex = Convert.ToInt32(e.CommandArgument);
            Pager1.CurrentIndex = currnetPageIndex;
            Bind_Data1(Pager1.CurrentIndex);
        }
        catch (Exception ex)
        {
            Common.WriteLog("QLHinhAnh.aspx.cs", "Pager1_Command()", ex.ToString());
        }
    }
    protected void cmdPrevious_Click(object sender, ImageClickEventArgs e)
    {
        if (Pager1.CurrentIndex > 1)
        {
            Pager1.CurrentIndex = Pager1.CurrentIndex - 1;
            Bind_Data1(Pager1.CurrentIndex);
        }
    }
    protected void cmdNext_Click(object sender, ImageClickEventArgs e)
    {
        if (Pager1.CurrentIndex < Convert.ToInt32(H_PageCount.Value))
        {
            Pager1.CurrentIndex = Pager1.CurrentIndex + 1;
            Bind_Data1(Pager1.CurrentIndex);
        }
    }

    public string GetTieuDe(object Char)
    {
        string s = Char.ToString();
        return Common.ConvertToUnSign(s);
    }
}